<?php
namespace app\admin\validate;

use think\Validate;

class Documents extends Validate{

    protected $rule = [
        'title' => 'require|max:50',
        'sort_id' => 'require|number',
        'sort' => 'eget:0',
        'type' => 'in:1,2,3',
        'keyword' => 'max:200',
        'abstract' => 'min:10,max:220',
        'comment' => 'in:1,2',
        'author' => 'max:50'
    ];

    protected $message = [
        'title.require' => '请填写文档标题',
        'title.max' => '标题最大长度为50个字符',
        'sort.eget' => '文档排序为大于等于0的整数',
        'keyword.max' => '关键词最大长度为200个字符',
        'abstract.min' => '摘要最小长度为10个字符',
        'abstract.max' => '摘要最大长度为220个字符',
        'type.in' => '类型错误',
        'comment.in' => '类型错误',
        'author.max' => '作者名称不能超过50个字符'
    ];
}